home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / linuxdoc-sgml-1.1 / rep / nroff / mapping < prev    next >
Text File  |  1995-05-03  |  12KB  |  639 lines

  1. % linuxdoc replacement file
  2. % translates into nroff, using ms macros
  3. % manpages can be processed using the man macros
  4. % does not use neqn for math.
  5.  
  6. % Based on qwertz replacement file by Tom Gordon
  7. % linuxdoc mods by mdw
  8.  
  9. % Groff dependencies are few.  To port to another roff: 
  10. % 1. Check and modify, if necessary, font changes.  (e.g. In psroff the
  11. % same fonts have other names.)
  12. % 2. Check the code for including Encapsulated PostScript, generated
  13. % for eps elements.
  14. % 3. Also make versions of general.grops and math.grops, which are sed
  15. % scripts translating character entities into groff character references.
  16.  
  17.  
  18. <linuxdoc>    +    ".nr PS 11\n"
  19.  
  20.             % Hacked by mdw
  21.             ".nr PI 3n\n"
  22.             ".ds CF \\\\n\%\n"    
  23.             ".ds CH \\&\n"
  24.             ".ds dR $\n"   % dollar, to avoid EQN conflicts
  25.  
  26.             % Start with no TOC
  27.             ".ds printtoc\n"
  28.             
  29.             % Footnote style
  30.             ".nr FF 1\n"
  31.  
  32.             % James Clark's trick to prevent unintended paragraph
  33.             % breaks
  34.  
  35.             ".tr \\&\n"
  36.  
  37.             % horizontal line
  38.             ".de hl\n"
  39.             ".br\n"
  40.             "\\l'\\\\n(.lu-\\\\n(.iu'\n"
  41.             "..\n"
  42.  
  43.             % paragraph spacing
  44.             ".if n .nr PD 1v\n"
  45.  
  46.             % margins added by mdw
  47.                         ".nr PO 0.25i\n"
  48.             ".po 0.25i\n"
  49.                         ".nr LL 7.0i\n"
  50.                         ".nr TL 7.0i\n"
  51.                         ".nr HM 0i\n"
  52.                         ".nr FM 0i\n"
  53.  
  54.             % Turn off right-margin filling 
  55.             ".na\n"
  56.             
  57.             % h is 1 if first paragraph after heading
  58.  
  59.             ".nr h 0\n" 
  60.  
  61.             % initialize heading level
  62.             
  63.             ".nr il 1\n"    
  64.  
  65.             % Number registers for list
  66.  
  67.             ".nr bi 0\n"  % initialize begin items
  68.             ".nr ll 0\n"  % list level, stores current level
  69.             ".nr el 0\n"  % current enumeration level
  70.  
  71.             % Not all list levels are enumerations, as 
  72.             % itemizations can be embedded within enumerations
  73.             % and vice versa
  74.             
  75.             % type of list level is in \n(t\n(ll, where
  76.             % 0 : itemize, 1 : enumerate, 2: description
  77.  
  78.             % enumerator for an enumeration level is in
  79.             % \n(e\n(el -- i.e. \n(e1=2 means current item of
  80.             % enumeration level 1 is 2
  81.             
  82.             % context-sensitive paragraph macro
  83.  
  84. % Bug: There's some problem using this to re-start paragraphs after the 
  85. % </verb> and </code>, so after verb and code I insert .LP. That's fine
  86. % except that is loses indentation when using verb or code inside of a list.
  87.  
  88. ".de Pp\n"
  89. ".ie \\\\n(ll>0 \\{\\\n"        % within list?
  90. ".ie \\\\n(bi=1 \\{\\\n"   % first par element of item?
  91. ".nr bi 0\n"     % reset bi flag
  92. % if itemization, mark with a bullet
  93. ".if \\\\n(t\\\\n(ll=0 \\{.IP \\\\(bu\\}\n" % itemize
  94. %  if enumeration: increment and print enumerator
  95. % for this enumeration level
  96. ".if \\\\n(t\\\\n(ll=1 \\{.IP \\\\n+(e\\\\n(el.\\}\n"
  97. % if first par element of descrip, do nothing
  98. ".\\}\n"  
  99. ".el .sp \n"        % subsequent par element of item
  100. ".\\}\n"
  101. ".el \\{\\\n"                 % not within list
  102. ".ie \\\\nh=1 \\{\\\n"    % first par after heading  
  103. ".LP\n"    
  104. ".nr h 0\n"    % reset h flag
  105. ".\\}\n"            
  106. ".el .LP \n"   % Changed from .PP, mdw
  107. ".\\}\n"
  108. ".nh\n"
  109. "..\n"    
  110.  
  111.             
  112.             
  113.             % for each level, a number register is created
  114.             % to store its type and current item number, where
  115.             % -1=bullet of an itemized list.
  116.  
  117.             % Format of list level enumerators
  118.  
  119.             ".ds f1 1\n"
  120.             ".ds f2 a\n"
  121.             ".ds f3 i\n"
  122.             ".ds f4 A\n"
  123.  
  124.             % Number registers for theorems
  125.             ".nr def 0\n"
  126.             ".nr prop 0\n"
  127.             ".nr lemma 0\n"
  128.             ".nr coroll 0\n"
  129.             ".nr proof 0\n"
  130.             ".nr theorem 0\n"
  131.  
  132.             % Reference commands
  133.  
  134. % redefine superscript strings so that refer tags look like [this]
  135.  
  136.             ".ds \[. \[\n"
  137.             ".ds .\] \]\n"
  138.  
  139. </linuxdoc>
  140.  
  141. % set initial level of headings, in register il
  142.  
  143. <article>        +    ".nr il 0"        +
  144. </article>        +    ".if '\\*[printtoc]'true' .PX\n" 
  145.  
  146. <report>        +     ".nr il 1"        +
  147. </report>    +    ".bp\n"
  148.             ".rm LH\n.rm RH\n"
  149.             ".TC"            +
  150.  
  151. <book>        +    ".nr il 1"        +
  152. </book>        +    ".rm LH\n.rm RH\n"
  153.             ".bp\n"
  154.             ".TC"            +
  155.  
  156. <notes>        
  157. </notes>
  158.  
  159. <manpage>    +    ".nr il -1"        +
  160. </manpage>    
  161.  
  162. % Hacked up titlepag stuff to look more reasonable. Titles and author
  163. % names are now stored in strings, printed by the end of </titlepag>.
  164. % Wake up! This uses groff-like long string names. You must use groff 
  165. % to format this.
  166.  
  167. <titlepag>    +    ".ds mdwtitle\n"
  168.             ".ds mdwsubtitle\n"
  169.             ".ds mdwdate\n"        
  170.             ".de printabstract\n"
  171.             "..\n"            +
  172. </titlepag>    +    "\\*[mdwtitle]\n"
  173.             ".br\n"
  174.             ".if !'\\*[mdwsubtitle]'' \\*[mdwsubtitle]\n"
  175.             ".br\n"
  176.             ".printauthor\n"
  177.             ".br\n"
  178.             "\\*[mdwdate]\n"
  179.             ".br\n"
  180.             ".printabstract\n"
  181.             ".br\n"    
  182.  
  183. %<title>        +    ".TL"            +
  184. %</title>    
  185.  
  186. <title>        +    ".ds mdwtitle "
  187. </title>    +
  188.  
  189. %<subtitle>    +    ".br\n"
  190. %            ".ft R\n"
  191. %            ".SM"        +
  192. %</subtitle>    +    ".LG"            +
  193.  
  194. <subtitle>    +    ".ds mdwsubtitle "    
  195. </subtitle>    +
  196.  
  197. <date>        +    ".ds mdwdate "    
  198. </date>        +
  199.  
  200. <abstract>    +     ".de printabstract\n"    
  201.             ".LP\n"
  202. </abstract>    +    ".."            +
  203.  
  204. % author needs to be set up as its own macro, fired off from .printtitle.
  205.  
  206. <author>    +     ".de printauthor"    +
  207. </author>    +    ".."            +
  208.  
  209. %<name>        +    ".AU"            +
  210. %</name>
  211.  
  212. <name>        +    ".br"            +
  213. </name>
  214.  
  215. <and>        
  216. </and>
  217.  
  218. <thanks>            "\\**\n"    
  219.             ".FS"            +
  220. </thanks>    +    ".FE"            +
  221.  
  222. <inst>        +    ".br"            +
  223. </inst>
  224.  
  225. <newline>    +    ".br"            +
  226. </newline>
  227.  
  228. <label>        
  229. </label>    
  230.  
  231. <header>    
  232. </header>    
  233.  
  234. <lhead>        +    ".EH '"
  235. </lhead>        "'''"        +
  236.  
  237. <rhead>        +    ".OH '''"
  238. </rhead>        "'"            +
  239.  
  240. <comment>    +    "(*"    +
  241. </comment>    +    "*)"    +
  242.  
  243. % New abstract given above --mdw
  244. %<abstract>    +    ".AB"            +
  245. %</abstract>    +    ".AE"            +
  246.  
  247. <appendix>    +     ".af H1 A"        +
  248. </appendix>
  249.  
  250. % limitation: no list of figures or tables.  A table of contents
  251. % is always generated for books and reports. Thus these next three tags
  252. % are no-ops
  253.  
  254. % For now, no table-of-contents in ASCII output. (Uncomment this if
  255. % desired).
  256. %<toc>        +    ".ds printtoc true"
  257. %</toc>
  258.  
  259. <toc>
  260. </toc>
  261.  
  262. <lof>    
  263. </lof>
  264.  
  265. <lot>    
  266. </lot>
  267.  
  268. <chapt>        +    ".bp\n"    
  269.             ".NH \\n(il "        +
  270. </chapt>
  271.  
  272. <sect>        +    ".NH 1+\\n(il"         +
  273. </sect>
  274.  
  275. <sect1>        +    ".NH 2+\\n(il"     +
  276. </sect1>
  277.  
  278. <sect2>        +    ".NH 3+\\n(il"        +
  279. </sect2>
  280.  
  281. <sect3>        +    ".NH 4+\\n(il"        +
  282. </sect3>    
  283.  
  284. <sect4>        +    ".NH 5+\\n(il"        +
  285. </sect4>
  286.  
  287. <heading>        ".ds h "
  288. </heading>    +    "\\*h\n"
  289.             ".XS \\n%\n"
  290.             "\\*(SN \\*h\n"
  291.             ".XE\n"        
  292.             ".nr h 1\n"  % set heading flag to true
  293.  
  294. <p>        +    ".Pp"            +   
  295. </p>
  296.  
  297. <itemize>    +    ".nr ll +1\n"       % increment list level
  298.             ".nr t\\n(ll 0\n"    % set type of level to itemize
  299. </itemize>    +    ".nr ll -1\n"    % decrement list level
  300.  
  301. <enum>        +    ".nr ll +1\n"        % increment list level
  302.             ".nr el +1\n"        % increment enumeration level
  303.             ".nr t\\n(ll 1\n"   % set type of level to enum
  304.             ".nr e\\n(el 0 1\n" % initialize enumerator
  305.             ".af e\\n(el \\*(f\\n(el\n" % style of enumerator
  306.             ".if \\n(ll>1 .RS"  +
  307. </enum>        +    ".if \\n(ll>1 .RE\n"
  308.             ".br\n"            
  309.             ".nr el -1\n"        % decrement enumeration level
  310.             ".nr ll -1\n"        % decrement list level 
  311.  
  312. <descrip>    +    ".RS\n"
  313.             ".nr ll +1\n"        % increment list level
  314.             ".nr t\\n(ll 2\n"   % set type of level to descrip
  315. </descrip>    +    ".nr ll -1\n"        % decrement list level
  316.             ".RE"        +
  317.  
  318. % number register bi means "begin item".  Used in the .P macro to print
  319. % bullets or numbers at beginning of first paragraph of an item.
  320. % If bi=1 then the paragraph is the first one of the item.
  321.  
  322. <item>        +    ".nr bi 1\n.Pp"        +
  323. </item>    
  324.  
  325. <tag>        +    ".IP \"\\fB"
  326. </tag>            "\\fP\"\n"
  327.             ".nr bi 1"            +
  328.  
  329. <cite>        +    ".\[\n[ID]\n.\]"    +
  330. </cite>    
  331.  
  332. <ncite>        +    ".\[\n[ID]\n.\]\n([NOTE])"
  333. </ncite>
  334.  
  335. <footnote>        " (-- "    
  336. </footnote>        "--)"            +
  337.  
  338. <sq>            "\\*Q"
  339. </sq>            "\\*U"
  340.  
  341. <lq>        +    ".RS\n"
  342.             ".nr LL \\n(LL-\\n(PI"    +
  343. </lq>        +    ".nr LL \\n(LL+\\n(PI\n"
  344.             ".RE"            +
  345.  
  346. <em>            "\\fI"            
  347. </em>             "\\fP"            
  348.  
  349. <bf>            "\\fB"            
  350. </bf>            "\\fR"            
  351.  
  352. <it>            "\\fI"            
  353. </it>            "\\fR"        
  354.  
  355. <sf>            "\\fR"        
  356. </sf>            "\\fR"            
  357.  
  358. <sl>            "\\fI"        
  359. </sl>            "\\fR"            
  360.  
  361. % Changed by mdw
  362. <tt>            "\\fC"
  363. </tt>            "\\fR"
  364.  
  365. % Added by mdw
  366. <cparam>        "\\fI<"
  367. </cparam>        ">\\fR"
  368.  
  369. <url>            "[NAME] (\\fC[URL]\\fR)"
  370. </url>
  371.  
  372. <ref>            "``[NAME]''"
  373. </ref>
  374.  
  375. <pageref>        "??"
  376. </pageref>
  377.  
  378. <x>    
  379. </x>
  380.  
  381. <mc>            
  382. </mc>
  383.  
  384. <biblio>    +    ".\[\n"
  385.             "$LIST$\n"
  386.             ".\]"            +
  387. </biblio>
  388.  
  389. <code>        +    ".DS L\n"
  390.             ".hl\n"
  391.             ".ft R\n"
  392.              ".eo"            +
  393.  
  394. </code>        +    ".ec\n"
  395.             ".hl\n"
  396.             ".DE\n"
  397.             ".ft P\n"
  398.         %    ".Pp"    + % continue previous paragraph (changed mdw)
  399.             ".LP"
  400.  
  401. <verb>        +    ".DS L\n"
  402.             ".ft R\n"
  403.              ".eo"            +
  404.  
  405. </verb>        +    ".ec\n"
  406.             ".DE\n"
  407.             ".ft P\n"
  408.          %    ".Pp"    +  % continue previous paragraph (changed mdw)
  409.             ".LP"
  410.  
  411. % tscreen added by mdw 
  412. <tscreen>       +       ".br\n"
  413.                         ".po 0.75i\n"
  414.                         ".ll 6.0i\n"
  415.                         ".ft C\n"
  416.                         ".LP\n"         % Used to be Pp
  417. </tscreen>      +       ".br\n"
  418.                         ".po 0.25i\n"
  419.                         ".ll 7.0i\n"
  420.                         ".ft R\n"       % This might not be correct
  421.                         ".LP\n"         % Used to be Pp
  422.  
  423. <quote>         +       ".br\n"
  424.                         ".po 0.75i\n"
  425.                         ".ll 6.0i\n"
  426.                         ".nr LL 6.0i\n"
  427.                         ".LP\n"         % Used to be Pp
  428. </quote>        +       ".br\n"
  429.                         ".po 0.25i\n"
  430.                         ".ll 7.0i\n"
  431.                         ".nr LL 7.0i\n"
  432.                         ".LP\n"         % Used to be Pp
  433.  
  434.  
  435.  
  436.  
  437. % theorems and such
  438.  
  439. <def>        +    ".sp\n"
  440.             ".nr def \\n\[def\]+1\n"
  441.             ".B \"Definition \\n\[def\] \"" +
  442. </def>        +    ".ft P\n.sp"         +
  443.  
  444. <prop>        +    ".sp\n"
  445.             ".nr prop \\n\[prop\]+1\n"
  446.             ".B \"Proposition \\n\[prop\] \"" +
  447. </prop>        +    ".ft P\n.sp"         +
  448.  
  449.  
  450. <lemma>        +    ".sp\n"
  451.             ".nr lemma \\n\[lemma\]+1\n"
  452.             ".B \"Lemma \\n\[lemma\] \""    +
  453. </lemma>    +    ".ft P\n.sp"         +
  454.  
  455. <coroll>    +    ".sp\n"
  456.             ".nr coroll \\n\[coroll\]+1\n"
  457.             ".B \"Corolloary \\n\[coroll\] \"" +
  458. </coroll>    +    ".ft P\n.sp"         +
  459.  
  460. <proof>        +    ".sp\n"
  461.             ".nr proof \\n\[proof\]+1\n"
  462.             ".B \"Proof \\n\[proof\] \""    +
  463. </proof>    +    ".ft P\n.sp"         +
  464.  
  465. <theorem>    +    ".sp\n"
  466.             ".nr theorem \\n\[theorem\]+1\n"
  467.             ".B \"Theorem \\n\[theorem\] \"" +
  468. </theorem>    +    ".ft P\n.sp"         +
  469.  
  470. <thtag>        +     ".B\n("
  471. </thtag>        ")\n.I"            +
  472.  
  473. % mathematics -- this nroff version needs work.
  474.  
  475. <f>                    
  476. </f>            
  477.  
  478. <dm>        +    ".DS L"                +
  479. </dm>        +    ".DE"            +
  480.  
  481. <eq>        +    ".DS L"            +
  482. </eq>        +    ".DE"            +
  483.  
  484. <fr>            
  485. </fr>        
  486.  
  487. <nu>            "{"
  488. </nu>            "} over "
  489.  
  490. <de>            "{"
  491. </de>            "}"
  492.  
  493. <lim>            
  494. </lim>
  495.  
  496. <op>
  497. </op>
  498.  
  499. <ll>            " from {"
  500. </ll>            "}"
  501.  
  502. <ul>            " to {"
  503. </ul>            "}"
  504.  
  505. <opd>
  506. </opd>
  507.  
  508. <pr>            " prod "
  509. </pr>
  510.  
  511. <in>            " int "
  512. </in>
  513.  
  514. <sum>            " sum "
  515. </sum>        
  516.  
  517. % limitation: eqn only does square roots!
  518.  
  519. <root>            " sqrt {"
  520. </root>            "}"
  521.  
  522. <ar>        +    ".TS\n"
  523.             "center, tab(|) ;\n"
  524.             "[ca]."            +
  525. </ar>        +    ".TE"            +
  526.  
  527. <arr>           "\n"            
  528. </arr>
  529.  
  530. <arc>           "|"
  531. </arc>
  532.  
  533.  
  534. <sup>            " sup {"
  535. </sup>            "}"
  536.  
  537. <inf>            " sub {"
  538. </inf>            "}"
  539.  
  540.  
  541. <unl>            "{"
  542. </unl>            "} under "
  543.  
  544. <ovl>            "{"
  545. </ovl>            "} bar "
  546.  
  547. <rf>            " bold{"
  548. </rf>            "}"
  549.  
  550. <v>            "{"
  551. </v>            "} vec "
  552.  
  553. % limitation: no calligraphic characters, using helvetica italics instead.  Is there a better font?
  554.  
  555. <fi>            "\\fI"    
  556. </fi>            "\\fP"    
  557.  
  558. <phr>            " roman }"
  559. </phr>            "}"
  560.  
  561.  
  562. <tu>        +    ".br"        +
  563. </tu>
  564.  
  565. % figures
  566.  
  567. <figure>    % +    ".KF"            +
  568. </figure>    % +    ".KE"            +
  569.  
  570. <eps>        +      ".if t .PSPIC [file].ps\n"
  571.             ".if n .sp 4"          +
  572. </eps>                    
  573.                 
  574. % Are TeX units properly handled by this translation of ph?
  575.  
  576. <ph>        +    ".sp [VSPACE]"        +
  577. </ph>    
  578.  
  579. <caption>    +    ".sp\n.ce"        +
  580. </caption>
  581.  
  582. % tables
  583.  
  584. <table>        +    ".KF\n.R"        +
  585. </table>    +    ".KE"            +
  586.  
  587. <tabular>    +    ".TS\n"
  588.             "center, tab(|) ; \n"
  589.             "[ca]."            +
  590. </tabular>    +    ".TE"            +
  591.  
  592. <rowsep>        "\n"            +
  593. </rowsep>
  594.  
  595. <colsep>        "|"
  596. </colsep>
  597.  
  598. <hline>        +    "_"            +
  599. </hline>
  600.  
  601. <slides>    +     ".nr PS 18"        +
  602. </slides>
  603.  
  604. <slide>    
  605. </slide>    +    ".bp\n\\&"            +
  606.  
  607. % letters -- replacement for email, using mh format.
  608.  
  609. <letter>    +    ".nf"    +
  610. </letter>    +
  611.  
  612. <from>        +     "From: "
  613. <to>        +    "To: "
  614.  
  615. <address>    +    ".de Ad\n"
  616. </address>    +    ".."    +
  617.  
  618. <email>            " <"
  619. </email>        ">"
  620.  
  621. <subject>    +    "Subject: "
  622.  
  623. <sref>        +    "Sref: "
  624. <rref>        +    "In-Reply-To: "
  625.  
  626. <cc>        +    "cc: "
  627.  
  628. <opening>    +    ".fi\n.LP"    +
  629.  
  630. <closing>    +    ".LP"        +
  631.  
  632. <encl>        +    ".XP\n"
  633.             "encl: "
  634.  
  635. <ps>        +    ".LP\np.s."
  636.  
  637.  
  638. % end of roff replacement file
  639.